<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
		function reset_clerk_info(){
		  $('#workno').val('');
		  $('#name').val('');
		  $('#deptno').val('');
		  $('#identifyno').val('');
		}
        function on_dept_select(node){
          $('#deptno').text(node.id);
          $('#deptno_val').val(node.id);
        }
        function on_panel_close(){
        	$("#sel_worker_dept_pane").panel("destroy");
        }

     	$('#queryworker').click(function (){
     	  $('#sel_worker_win').window('open');
    	});
    	$(document).ready(function(){
    		set_input_keydown_event();
    		$('#sysno').combobox({onLoadSuccess:reset_sysno,onSelect:function(record){
    		  $('#workno').attr('maxlength', record.clerknolen);
    		}});
     		$('#add_clerk_panel').panel({
     			onClose:on_panel_close, onOpen:function(){
     			$('#sysno').combobox('reload','querySystemList.action?flag=0');
     		}});
    		
     		$('#save').click(function (){
     		  $('#sysno_val').val($('#sysno').combobox('getValue'));
    		  $('#add_clerk_form').form('submit', {
    		    url: 'addClerk.action',
    		    error:function(message){
    		    	alert('提交数据错误，服务器可能已关闭！系统返回:'+message);
    		  	},
    		    success:function(data){
    		      var a = eval('(' + data + ')');
    		      $.messager.alert('增加账户', a.message, 'info',
    		      	function(){$('#queryworker').focus()});
    		      
    		      if (a.result == '0'){
    		      	reset_clerk_info();
    		      }
    		    }
    		    })
    		});

     		$('#cancel').click(function (){
     			$('#add_clerk_panel').panel('close');
    		});
			combobox_keypress('#sysno','#workno');
    	});
    </script>
	</head>
	<body>
	<s:include value="selectworker.jsp"></s:include>
    <div id="add_clerk_panel" collapsible="false" fit="true" title="增加账户" 
    	resizable="false" minimizable="false" maximizable="false" closable="true" 
    	icon="icon-save" class="jquery_panel" style="background-color: #fff">
    	<s:form id="add_clerk_form" action="addClerk" theme="simple">
			<table style="margin: 20px,100px">
			    <tr height="28px">
    				<td align="right"><s:label value="身份证号：" for="identifyno"></s:label></td>
			    	<td><input id="identifyno" disabled="disabled" 
    					style="width:140px" class="text_field_css"></input>
    					<label style="width:4px"></label><s:hidden id="identifyno_val" name="identifyno"></s:hidden>
    					<button id="queryworker" class="buttons_css" style="width:80px">
    						<label style="80px" class="infoclass">查询员工</label></button></td>
			    </tr>
    			<tr height="28px">
			    	<td align="right"><s:label value="机构："></s:label></td>
    				<td><input id="deptno" disabled="disabled" class="text_field_css" 
    					style="width:228px"/></td>
			    </tr>
    			<tr height="28px">
			    	<td align="right"><s:label value="姓名："></s:label></td>
    				<td><input id="name" disabled="disabled" class="text_field_css" 
    					style="width:228px"/></td>
    			</tr>
    			<tr height="28px">
			    	<td align="right"><s:label value="应用系统：" for="sysno"></s:label></td>
    				<td><s:textfield id="sysno" valueField="sysno" textField="sysname" 
    					style="width:228px" editable="false" panelHeight="auto"></s:textfield>
			    		<s:hidden id="sysno_val" name="sysno"></s:hidden> </td>
    			</tr>
    			<tr height="28px">
			    	<td align="right"><s:label value="账户号：" for="workno"></s:label></td>
    				<td><input id="workno" name="workno" style="width:178px" maxlength=6
    					class="text_field_css"></input><label style="width:4px"></label>
			    		<label style="color:red">*</label><label>必输项</label></td>
			    </tr>
    			<tr height="35px">
			    	<td align="right">
            		</td>
            		<td>
            			<button id="save" class="buttons_css" style="width:70px">
            				<label style="70px" class="save_css">保存</label></button>            				
            			<label style="width:10px"></label>
			            <button id="cancel" class="buttons_css" style="width:70px">
			            	<label style="70px" class="cancel_css">返回</label></button>
    				</td>
			    </tr>
    		</table>
    	</s:form>
    </div>
    </body>
</html>